﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Attendences.Framework.Entity;

public partial class Page_OtherUserDetail : System.Web.UI.Page
{
    public Guid UserID
    {
        get
        {
            if (Request.QueryString["ID"] != null)
                return new Guid(Request.QueryString["ID"]);
            return Guid.Empty;
        }
    }
    protected void btnRefresh_Click(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(this.GetType(), "Finish", "<script>parent.document.getElementById('ctl00$ListToolBarPlaceHolder$btnRefresh').click();</script>");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DetailMaster dm = this.Master as DetailMaster;
            dm.UseTabber = true;
            if (UserID != Guid.Empty)
            {
                OtherUser user = new OtherUser(UserID);
                user.Load();
                ltAddress.Text = user.Address;
                ltCreateTime.Text = user.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
                ltDisplay.Text = user.DisplayName;
                ltEmail.Text = user.Email;
                ltMobile.Text = user.Mobile;
                ltPhone.Text = user.Phone;
                ltTitle.Text = user.DisplayName;
            }
        }
    }
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        if (UserID != Guid.Empty)
        {
            OtherUser user = new OtherUser(UserID);
            user.Load();
            user.Delete();
            ClientScript.RegisterStartupScript(GetType(), "del", "alert('删除成功');refreshParent();", true);
        }
    }
}